home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / CIncludes / CTBUtilities.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-06  |  6.7 KB  |  278 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CTBUtilities.h
  3.  
  4.      Contains:    Communications Toolbox Utilities interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __CTBUTILITIES__
  21. #define __CTBUTILITIES__
  22.  
  23.  
  24. #ifndef __MEMORY__
  25. #include <Memory.h>
  26. #endif
  27. /*    #include <Types.h>                                            */
  28. /*        #include <ConditionalMacros.h>                            */
  29. /*    #include <MixedMode.h>                                        */
  30.  
  31. #ifndef __DIALOGS__
  32. #include <Dialogs.h>
  33. #endif
  34. /*    #include <Errors.h>                                            */
  35. /*    #include <Menus.h>                                            */
  36. /*        #include <Quickdraw.h>                                    */
  37. /*            #include <QuickdrawText.h>                            */
  38. /*    #include <Controls.h>                                        */
  39. /*    #include <Windows.h>                                        */
  40. /*        #include <Events.h>                                        */
  41. /*            #include <OSUtils.h>                                */
  42. /*    #include <TextEdit.h>                                        */
  43.  
  44. #ifndef __STANDARDFILE__
  45. #include <StandardFile.h>
  46. #endif
  47. /*    #include <Files.h>                                            */
  48. /*        #include <Finder.h>                                        */
  49.  
  50. #ifndef __APPLETALK__
  51. #include <AppleTalk.h>
  52. #endif
  53.  
  54. #ifdef __cplusplus
  55. extern "C" {
  56. #endif
  57.  
  58. #if PRAGMA_ALIGN_SUPPORTED
  59. #pragma options align=mac68k
  60. #endif
  61.  
  62. #if PRAGMA_IMPORT_SUPPORTED
  63. #pragma import on
  64. #endif
  65.  
  66.  
  67. enum {
  68. /*    version of Comm Toolbox Utilities    */
  69.     curCTBUVersion                = 2,
  70. /*    Error codes/types    */
  71.     ctbuGenericError            = -1,
  72.     ctbuNoErr                    = 0
  73. };
  74.  
  75. typedef OSErr CTBUErr;
  76.  
  77.  
  78. enum {
  79.     chooseDisaster                = -2,
  80.     chooseFailed,
  81.     chooseAborted,
  82.     chooseOKMinor,
  83.     chooseOKMajor,
  84.     chooseCancel
  85. };
  86.  
  87. typedef unsigned short ChooseReturnCode;
  88.  
  89.  
  90. enum {
  91.     nlOk,
  92.     nlCancel,
  93.     nlEject
  94. };
  95.  
  96. typedef unsigned short NuLookupReturnCode;
  97.  
  98.  
  99. enum {
  100.     nameInclude                    = 1,
  101.     nameDisable,
  102.     nameReject
  103. };
  104.  
  105. typedef unsigned short NameFilterReturnCode;
  106.  
  107.  
  108. enum {
  109.     zoneInclude                    = 1,
  110.     zoneDisable,
  111.     zoneReject
  112. };
  113.  
  114. typedef unsigned short ZoneFilterReturnCode;
  115.  
  116. typedef pascal short (*DialogHookProcPtr)(short item, DialogPtr theDialog);
  117.  
  118. #if GENERATINGCFM
  119. typedef UniversalProcPtr DialogHookUPP;
  120. #else
  121. typedef DialogHookProcPtr DialogHookUPP;
  122. #endif
  123.  
  124. enum {
  125.     uppDialogHookProcInfo = kPascalStackBased
  126.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  127.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  128.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DialogPtr)))
  129. };
  130.  
  131. #if GENERATINGCFM
  132. #define NewDialogHookProc(userRoutine)        \
  133.         (DialogHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture())
  134. #else
  135. #define NewDialogHookProc(userRoutine)        \
  136.         ((DialogHookUPP) (userRoutine))
  137. #endif
  138.  
  139. #if GENERATINGCFM
  140. #define CallDialogHookProc(userRoutine, item, theDialog)        \
  141.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppDialogHookProcInfo, (item), (theDialog))
  142. #else
  143. #define CallDialogHookProc(userRoutine, item, theDialog)        \
  144.         (*(userRoutine))((item), (theDialog))
  145. #endif
  146.  
  147.  
  148. enum {
  149. /*    Values for hookProc items        */
  150.     hookOK                        = 1,
  151.     hookCancel                    = 2,
  152.     hookOutline                    = 3,
  153.     hookTitle                    = 4,
  154.     hookItemList                = 5,
  155.     hookZoneTitle                = 6,
  156.     hookZoneList                = 7,
  157.     hookLine                    = 8,
  158.     hookVersion                    = 9,
  159.     hookReserved1                = 10,
  160.     hookReserved2                = 11,
  161.     hookReserved3                = 12,
  162.     hookReserved4                = 13,
  163. /*    "virtual" hookProc items    */
  164.     hookNull                    = 100,
  165.     hookItemRefresh                = 101,
  166.     hookZoneRefresh                = 102,
  167.     hookEject                    = 103,
  168.     hookPreflight                = 104,
  169.     hookPostflight                = 105,
  170.     hookKeyBase                    = 1000
  171. };
  172.  
  173. /*    NuLookup structures/constants    */
  174. struct NLTypeEntry {
  175.     Handle                            hIcon;
  176.     Str32                            typeStr;
  177. };
  178. typedef struct NLTypeEntry NLTypeEntry;
  179.  
  180. typedef NLTypeEntry NLType[4];
  181.  
  182. struct NBPReply {
  183.     EntityName                        theEntity;
  184.     AddrBlock                        theAddr;
  185. };
  186. typedef struct NBPReply NBPReply;
  187.  
  188. typedef pascal short (*NameFilterProcPtr)(EntityName *theEntity);
  189.  
  190. #if GENERATINGCFM
  191. typedef UniversalProcPtr NameFilterUPP;
  192. #else
  193. typedef NameFilterProcPtr NameFilterUPP;
  194. #endif
  195.  
  196. enum {
  197.     uppNameFilterProcInfo = kPascalStackBased
  198.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  199.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EntityName*)))
  200. };
  201.  
  202. #if GENERATINGCFM
  203. #define NewNameFilterProc(userRoutine)        \
  204.         (NameFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture())
  205. #else
  206. #define NewNameFilterProc(userRoutine)        \
  207.         ((NameFilterUPP) (userRoutine))
  208. #endif
  209.  
  210. #if GENERATINGCFM
  211. #define CallNameFilterProc(userRoutine, theEntity)        \
  212.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppNameFilterProcInfo, (theEntity))
  213. #else
  214. #define CallNameFilterProc(userRoutine, theEntity)        \
  215.         (*(userRoutine))((theEntity))
  216. #endif
  217.  
  218. typedef pascal short (*ZoneFilterProcPtr)(ConstStr32Param theZone);
  219.  
  220. #if GENERATINGCFM
  221. typedef UniversalProcPtr ZoneFilterUPP;
  222. #else
  223. typedef ZoneFilterProcPtr ZoneFilterUPP;
  224. #endif
  225.  
  226. enum {
  227.     uppZoneFilterProcInfo = kPascalStackBased
  228.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  229.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ConstStr32Param)))
  230. };
  231.  
  232. #if GENERATINGCFM
  233. #define NewZoneFilterProc(userRoutine)        \
  234.         (ZoneFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture())
  235. #else
  236. #define NewZoneFilterProc(userRoutine)        \
  237.         ((ZoneFilterUPP) (userRoutine))
  238. #endif
  239.  
  240. #if GENERATINGCFM
  241. #define CallZoneFilterProc(userRoutine, theZone)        \
  242.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppZoneFilterProcInfo, (theZone))
  243. #else
  244. #define CallZoneFilterProc(userRoutine, theZone)        \
  245.         (*(userRoutine))((theZone))
  246. #endif
  247.  
  248. typedef NameFilterProcPtr nameFilterProcPtr;
  249.  
  250. typedef ZoneFilterProcPtr zoneFilterProcPtr;
  251.  
  252. extern pascal CTBUErr InitCTBUtilities(void);
  253. extern pascal short CTBGetCTBVersion(void);
  254. extern pascal short StandardNBP(Point where, ConstStr255Param prompt, short numTypes, NLType typeList, NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter, DialogHookUPP hook, NBPReply *theReply);
  255. extern pascal short CustomNBP(Point where, ConstStr255Param prompt, short numTypes, NLType typeList, NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter, DialogHookUPP hook, long userData, short dialogID, ModalFilterUPP filter, NBPReply *theReply);
  256. #if OLDROUTINENAMES
  257. #define NuLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter, hook, theReply)  \
  258.     StandardNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter,  \
  259.     hook, theReply)
  260. #define NuPLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter, hook, userData, dialogID, filter, theReply)  \
  261.     CustomNBP(where, prompt, numTypes, typeList, nameFilter,  \
  262.     zoneFilter, hook, userData, dialogID, filter, theReply)
  263. #endif
  264.  
  265. #if PRAGMA_IMPORT_SUPPORTED
  266. #pragma import off
  267. #endif
  268.  
  269. #if PRAGMA_ALIGN_SUPPORTED
  270. #pragma options align=reset
  271. #endif
  272.  
  273. #ifdef __cplusplus
  274. }
  275. #endif
  276.  
  277. #endif /* __CTBUTILITIES__ */
  278.